function aaa(obj){ 
return document.getElementById(obj); 
} 
function go(stop){ 
aaa("bar").style.width = parseInt(aaa("bar").style.width) + 1 + "%";
aaa("span1").innerText = parseInt(aaa("span1").innerText) + Math.round((1*(span2/span1)));
aaa("bar").innerHTML =aaa("bar").style.width;
if(aaa("bar").style.width == stop+"%"){ 
aaa("span1").innerText=s;
clearInterval(bar); 

} 
} 
var span1=document.getElementById("span1").innerHTML;
var span2=document.getElementById("span2").innerHTML;
var rate=(parseFloat(span1)/parseFloat(span2));
var s=span1;
aaa("span1").innerText=0;
rate=parseInt(rate*100);
var bar = setInterval("go("+rate+")",50); 


